<?php
/**
 * Created by laoyu.
 * User: hilaoyu@qq.com
 * Date: 2018/5/22
 * Time: 17:11
 */

namespace Hilaoyu\LaravelExtend\Providers;

use Hilaoyu\LaravelExtend\Services\Files\FileService;
use Hilaoyu\LaravelExtend\Supports\SubApp;
use Hilaoyu\Utils\UtilSupport;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

class CaptchaServiceProvider extends BaseServiceProvider
{
    public function boot()
    {
        $this->publishes([
            $this->configPath() => config_path('captcha.php'),
        ]);

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom($this->configPath(), 'captcha');
        //$this->app->instance('captcha.registered', true);
        SubApp::registerCommands(dirname(__DIR__).'/Services/Captcha/Console','Hilaoyu\\LaravelExtend\\Services\\Captcha\\Console');

        SubApp::registerRoutes(dirname(__DIR__) . '/Services/Captcha/routes','Hilaoyu\\LaravelExtend\\Services\\Captcha\\Controllers',[
            'name'=>'l-e-s',
            'prefix'=>'_les',
        ]);
        config()->set('laravel-extend.services.captcha.registered',true);
    }


    protected function configPath()
    {
        return dirname(__DIR__) . '/Services/Captcha/config/captcha.php';
    }
}
